home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / resolver / resolver.exe / _SETUP.1 / Form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-07-24  |  4.8 KB  |  149 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Sample for IP Resolver"
  4.    ClientHeight    =   3960
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4680
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   3960
  10.    ScaleWidth      =   4680
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.Frame Frame2 
  13.       Caption         =   "Forward lookup"
  14.       Height          =   1575
  15.       Left            =   120
  16.       TabIndex        =   6
  17.       Top             =   120
  18.       Width           =   4455
  19.       Begin VB.CommandButton Command3 
  20.          Caption         =   "Resolve the Hostname"
  21.          Height          =   375
  22.          Left            =   2520
  23.          TabIndex        =   9
  24.          Top             =   1080
  25.          Width           =   1815
  26.       End
  27.       Begin VB.TextBox Text2 
  28.          Height          =   285
  29.          Left            =   120
  30.          TabIndex        =   8
  31.          Top             =   600
  32.          Width           =   1695
  33.       End
  34.       Begin VB.TextBox Text1 
  35.          BackColor       =   &H8000000F&
  36.          Height          =   285
  37.          Left            =   2040
  38.          TabIndex        =   7
  39.          Top             =   600
  40.          Width           =   2295
  41.       End
  42.       Begin VB.Label Label2 
  43.          Caption         =   "Host name:"
  44.          Height          =   255
  45.          Left            =   120
  46.          TabIndex        =   10
  47.          Top             =   360
  48.          Width           =   1695
  49.       End
  50.    End
  51.    Begin VB.Frame Frame1 
  52.       Caption         =   "Reverse lookup"
  53.       Height          =   1575
  54.       Left            =   120
  55.       TabIndex        =   1
  56.       Top             =   1800
  57.       Width           =   4455
  58.       Begin VB.CommandButton Command1 
  59.          Caption         =   "Resolve the IP"
  60.          Height          =   375
  61.          Left            =   2520
  62.          TabIndex        =   4
  63.          Top             =   1080
  64.          Width           =   1815
  65.       End
  66.       Begin VB.TextBox txtIP 
  67.          Height          =   285
  68.          Left            =   120
  69.          TabIndex        =   3
  70.          Top             =   600
  71.          Width           =   1695
  72.       End
  73.       Begin VB.TextBox txtHost 
  74.          BackColor       =   &H8000000F&
  75.          Height          =   285
  76.          Left            =   2040
  77.          TabIndex        =   2
  78.          Top             =   600
  79.          Width           =   2295
  80.       End
  81.       Begin VB.Label Label1 
  82.          Caption         =   "IP Address"
  83.          Height          =   255
  84.          Left            =   120
  85.          TabIndex        =   5
  86.          Top             =   360
  87.          Width           =   1695
  88.       End
  89.    End
  90.    Begin VB.CommandButton Command2 
  91.       Cancel          =   -1  'True
  92.       Caption         =   "Close"
  93.       Height          =   375
  94.       Left            =   3600
  95.       TabIndex        =   0
  96.       Top             =   3480
  97.       Width           =   975
  98.    End
  99. Attribute VB_Name = "Form1"
  100. Attribute VB_GlobalNameSpace = False
  101. Attribute VB_Creatable = False
  102. Attribute VB_PredeclaredId = True
  103. Attribute VB_Exposed = False
  104. Private Sub Command1_Click()
  105.     txtHost.Text = ""
  106.     If Len(Trim(txtIP.Text)) <= 1 Then
  107.         MsgBox "Please enter a valid IP in the IP address textbox."
  108.         Exit Sub
  109.     End If
  110.     '   Create a new sockets name resolver object:
  111.     Dim wsrResolver As New WSResolver
  112.     '   Create a string (and allocate space)
  113.     '   NOTE:  This string MUST be long enough
  114.     '   for the FQDN!
  115.     Dim tempString As String * 200
  116.     '   Call the method:
  117.     wsrResolver.GetHostByAddr txtIP.Text, tempString
  118.     '   Trim off the trailing nulls and print:
  119.     Dim sRetVal As String
  120.     sRetVal = Trim$(Left$(tempString, InStr(1, tempString, Chr(0))))
  121.     txtHost.Text = sRetVal
  122.     '   Call 'release' on the COM object:
  123.     Set wsrResolver = Nothing
  124. End Sub
  125. Private Sub Command2_Click()
  126.     End
  127. End Sub
  128. Private Sub Command3_Click()
  129.     Text1.Text = ""
  130.     If Len(Trim(Text2.Text)) <= 1 Then
  131.         MsgBox "Please enter a valid Hostname in the Hostname textbox."
  132.         Exit Sub
  133.     End If
  134.     '   Create a new sockets name resolver object:
  135.     Dim wsrResolver As New WSResolver
  136.     '   Create a string (and allocate space)
  137.     '   NOTE:  This string MUST be long enough
  138.     '   for the FQDN!
  139.     Dim tempString As String * 200
  140.     '   Call the method:
  141.     wsrResolver.GetAddrByHost Text2.Text, tempString
  142.     '   Trim off the trailing nulls and print:
  143.     Dim sRetVal As String
  144.     sRetVal = Trim$(Left$(tempString, InStr(1, tempString, Chr(0))))
  145.     Text1.Text = sRetVal
  146.     '   Call 'release' on the COM object:
  147.     Set wsrResolver = Nothing
  148. End Sub
  149.